function e(e, t, c) {
    return t in e ? Object.defineProperty(e, t, {
        value: c,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = c, e;
}

var t, c = getApp(), a = require("../../339469457B99569C55F201426D89DBD0.js"), i = require("../../38034BA77B99569C5E6523A090A9DBD0.js"), o = a.getImgCheckurl(), s = a.getFacecosmeticiurl();

Page((t = {
    data: {
        motto: "腾讯优图",
        images: {},
        img: "",
        remark: "",
        model: 0,
        tempFilePaths: "",
        userInfo: {},
        currentTab: 0,
        backUserInfo: {},
        hasUserInfo: !1,
        openId: "",
        nickName: "",
        token: null,
        canIUse: wx.canIUse("button.open-type.getUserInfo"),
        facecosmeticJP: [ {
            id: "1",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/1.png",
            text: "芭比粉"
        }, {
            id: "2",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/2.png",
            text: "清透"
        }, {
            id: "3",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/3.png",
            text: "烟灰"
        }, {
            id: "4",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/4.png",
            text: "自然"
        }, {
            id: "5",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/5.png",
            text: "樱花粉"
        }, {
            id: "6",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/6.png",
            text: "原宿红"
        } ],
        facecosmeticKO: [ {
            id: "7",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/7.png",
            text: "闪亮"
        }, {
            id: "8",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/8.png",
            text: "粉紫"
        }, {
            id: "9",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/9.png",
            text: "粉嫩"
        }, {
            id: "10",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/10.png",
            text: "自然"
        }, {
            id: "11",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/11.png",
            text: "清透"
        }, {
            id: "12",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/12.png",
            text: "大地色"
        }, {
            id: "13",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/13.png",
            text: "玫瑰"
        } ],
        facecosmeticNL: [ {
            id: "14",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/14.png",
            text: "自然"
        }, {
            id: "15",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/15.png",
            text: "清透"
        }, {
            id: "16",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/16.png",
            text: "桃粉"
        }, {
            id: "17",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/17.png",
            text: "橘粉"
        }, {
            id: "18",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/18.png",
            text: "春夏"
        }, {
            id: "19",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/19.png",
            text: "秋冬"
        } ],
        facecosmeticTH: [ {
            id: "20",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/20.png",
            text: "经典复古"
        }, {
            id: "21",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/21.png",
            text: "性感混血"
        }, {
            id: "22",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/22.png",
            text: "炫彩明眸"
        }, {
            id: "23",
            url: "https://wximage-1251091977.cos.ap-beijing.myqcloud.com/facecosmetic/23.png",
            text: "紫色魅惑"
        } ]
    },
    onShareAppMessage: function() {
        return {
            title: "快来看看自己适合什么妆",
            path: "/pages/facecosmetic/facecosmetic",
            success: function(e) {
                "shareAppMessage:ok" == e.errMsg && wx.showToast({
                    title: "分享成功",
                    icon: "success",
                    duration: 500
                });
            },
            fail: function(e) {
                "shareAppMessage:fail cancel" == e.errMsg && wx.showToast({
                    title: "分享取消",
                    icon: "loading",
                    duration: 500
                });
            }
        };
    },
    bindViewTap: function() {
        wx.navigateTo({
            url: "../logs/logs"
        });
    },
    clickTab: function(e) {
        var t = this;
        if (this.data.currentTab === e.target.dataset.current) return !1;
        t.setData({
            currentTab: e.target.dataset.current
        });
    },
    onFaceMerge: function(e) {
        var t = this, c = e.currentTarget.dataset.id;
        console.info("modelId=" + c), t.data.tempFilePaths ? (t.setData({
            model: c
        }), setTimeout(function() {
            wx.showLoading({
                title: "智能处理中",
                mask: !0
            });
        }, 500), wx.uploadFile({
            url: o,
            filePath: e.tempFilePaths[0],
            header: {
                "content-type": "multipart/form-data"
            },
            name: "file",
            formData: {
                code: "XSYD"
            },
            success: function(e) {
                var a = JSON.parse(e.data);
                "0" == a.errcode ? wx.uploadFile({
                    url: s,
                    filePath: t.data.tempFilePaths[0],
                    header: {
                        "content-type": "multipart/form-data"
                    },
                    name: "file",
                    formData: {
                        model: c
                    },
                    success: function(e) {
                        var c = e.data, a = JSON.parse(c);
                        console.log(a.ret), 0 == a.ret ? t.setData({
                            img: "data:image/png;base64," + a.data.image
                        }) : 16402 == a.ret ? wx.showModal({
                            title: "温馨提示",
                            content: "图片中不包含人脸哦",
                            showCancel: !1
                        }) : wx.showModal({
                            title: "温馨提示",
                            content: "服务器远走高飞了",
                            showCancel: !1
                        }), wx.hideToast();
                    },
                    fail: function(e) {
                        wx.hideToast(), wx.hideLoading(), wx.showModal({
                            title: "上传失败",
                            content: "服务器远走高飞了",
                            showCancel: !1
                        });
                    }
                }) : "87014" == a.errcode ? (wx.hideLoading(), wx.showModal({
                    content: "存在敏感内容，请更换图片",
                    showCancel: !1,
                    confirmText: "明白了"
                }), t.setData({
                    img: null
                })) : (wx.hideLoading(), wx.showModal({
                    content: "其他错误，稍后再试",
                    showCancel: !1,
                    confirmText: "明白了"
                }));
            }
        })) : wx.showToast({
            title: "快选择图片吧",
            icon: "none",
            mask: !0,
            duration: 1e3
        });
    },
    chooseImage: function() {
        var e = this;
        wx.chooseImage({
            count: 1,
            sourceType: [ "album", "camera" ],
            sizeType: [ "compressed" ],
            success: function(t) {
                console.log(t), t.tempFiles[0].size > 512e3 ? wx.showToast({
                    title: "图片文件过大哦",
                    icon: "none",
                    mask: !0,
                    duration: 1500
                }) : e.setData({
                    img: t.tempFilePaths[0],
                    tempFilePaths: t.tempFilePaths
                });
            }
        });
    }
}, e(t, "chooseImage", function() {
    var e = this;
    wx.chooseImage({
        count: 1,
        sourceType: [ "album", "camera" ],
        sizeType: [ "compressed" ],
        success: function(t) {
            console.log(t), t.tempFiles[0].size > 512e3 ? wx.showToast({
                title: "图片文件过大哦",
                icon: "none",
                mask: !0,
                duration: 1500
            }) : e.setData({
                img: t.tempFilePaths[0],
                tempFilePaths: t.tempFilePaths
            });
        }
    });
}), e(t, "onLoad", function() {
    var e = this, t = c.data.openId;
    this.setData({
        openId: t
    }), i.tokenRequest({
        success: function(t) {
            e.setData({
                token: t.access_token
            });
        }
    });
}), e(t, "preview", function(e) {
    var t = this;
    wx.previewImage({
        urls: [ t.data.img ],
        current: t.data.img
    });
}), t));